<template>
    <div>
        <h1>管理员登录页面</h1>
            <table class="table">
                <thead>
                    <tr>
                        <td>账号:</td>
                        <td><input type="text" v-model="data.name"></td>
                    </tr>
                    <tr>
                        <td>密码:</td>
                        <td><input type="password" v-model="data.pwd"></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td><input type="button" value="登录" @click="Dl"></td>
                    </tr>
                </thead>
            </table>
    </div>
</template>

<script setup lang="ts">
import {ref} from 'vue'
import axios from 'axios'
import { useRouter } from 'vue-router'
const router = useRouter();

const data = ref({
    name:'',
    pwd:''
})

const Dl=()=>{
    axios.get("/api/User/DLUser",{params:data.value}).then(res=>{
                if(res.data==1)
            {
                alert("用户不存在!");
                return;
            }
            if(res.data==2)
            {
                alert("密码错误!");
                return;
            }
            if(res.data==3)
            {
                alert("登陆成功!");
               router.push({path:'/BingHomeShow'});
            }
    })
}

</script>

<style scoped>

</style>